Always emit unmap when a widget is unmapped
authorHavoc Pennington <hp@pobox.com>
Mon, 20 Dec 2010 18:04:45 +0000 (13:04 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 20 Dec 2010 18:04:45 +0000 (13:04 -0500)
Previously, for performance reasons we would sometimes
skip invoking the unmap signal (and associated vfunc)
in favor of simply unrealizing. However, widgets then
had no way to clean stuff up when they were hidden
(but still inside a parent which was shown).

This patch also removes _gtk_tooltip_hide() which
was done in both unmap and unrealize in gtkwidget.c,
now can only be in unmap.

There are probably lots of things cleaned up in
unrealize that would now be better to move to unmap.

https://bugzilla.gnome.org/show_bug.cgi?id=629923

gtk/gtkwidget.c

index 92e427891206fbd73358b1096d47a5d2a285bade..d261b1324575e7d49fb68fc673b1b66e9bbecba7 100644 (file)
@@ -4318,10 +4318,14 @@ gtk_widget_unrealize (GtkWidget *widget)
   if (gtk_widget_get_realized (widget))
     {
       g_object_ref (widget);
-      _gtk_tooltip_hide (widget);
+
+      if (widget->priv->mapped)
+        gtk_widget_unmap (widget);
+
       g_signal_emit (widget, widget_signals[UNREALIZE], 0);
+      g_assert (!widget->priv->mapped);
       gtk_widget_set_realized (widget, FALSE);
-      gtk_widget_set_mapped (widget, FALSE);
+
       g_object_unref (widget);
     }
 
@@ -10507,10 +10511,7 @@ gtk_widget_real_unrealize (GtkWidget *widget)
 {
   GtkWidgetPrivate *priv = widget->priv;
 
-  if (gtk_widget_get_mapped (widget))
-    gtk_widget_real_unmap (widget);
-
-  gtk_widget_set_mapped (widget, FALSE);
+  g_assert (!widget->priv->mapped);
 
   /* printf ("unrealizing %s\n", g_type_name (G_TYPE_FROM_INSTANCE (widget)));
    */